package api;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.Vector;

/**
 * The interface that is implemented by a client to 
 * communicate with the Master Server
 * 
 * @author Mayuri Karra, Bing Wei
 *
 */

public interface Client2Master extends Remote{
	public static String SERVICE_NAME = "spaceService";
	
	/**
	 * Method to enqueue a map reduce task with 
	 * the MapReduce master
	 * @param task
	 * @throws RemoteException
	 */
	public void addTask(TaskBase task) throws RemoteException;
	/**
	 * The blocking method which returns when a given task is done 
	 * processing
	 * 
	 * @return the taskId assigned to the task by the task server
	 * @throws RemoteException
	 */
	public Long finish() throws RemoteException;
	
	/**
	 * Lookup method to lookup a key and return the result
	 * embedded in a String
	 * @param taskId of the task corresponding to this lookup
	 * @param key to lookup[ for
	 * @return the String which has the result
	 * @throws RemoteException
	 */
	public String lookup(long taskId, String key) throws RemoteException;

	/**
	 * A method that returns the status of all the worker threads 
	 * @return a vector of Strings which indicate the status of each Worker
	 * @throws RemoteException
	 */
	public Vector<String> ping() throws RemoteException;
		
}
